package com.tang.campus_market.dao;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.tang.campus_market.entity.Comment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface CommentDao extends BaseMapper<Comment> {
    @Update("update comment_user set state=#{state} where #{columnName}=#{id}")
    int updateCommentStateByColumnName(@Param("columnName") String columnName,
                                       @Param("id") Integer id,
                                       @Param("state") String state);
    @Update("update comment_user set state=#{state} where id=#{id}")
    int updateCommentStateById(        @Param("id") Integer id,
                                       @Param("state") String state);
    @Update("update comment_user set state=#{state} where root_id=#{rootId}")
    int updateCommentStateByRootId(        @Param("rootId") Integer rootId,
                                       @Param("state") String state);

}
